//简版阶乘
function JeChen(n)
{
    var r=1
    for(var i=1;i<=n;i++)
    {
        r = r * i
    }
    return r
}
//console.log(JeChen(4));

var a=1
function fn()
{
    var a =2
    function fn1()
    {
         function fn2()
        {
            console.log(a);
            
        }
        fn2()
        console.log(a);
    }
    fn1()
}
fn()

function JianBing(kouWei)
{
    var r="煎饼果子"
    r =  kouWei(r)
    return r
}

function MyKouWei(food)
{
    food += " 香菜 葱花 "
    return food;
}
var f =  JianBing(MyKouWei)
// console.log(f);

function NewJeChen(x)
{
    var r =1
    if(x<1)
    {
        return "请输入整数"
    }
    if(x=1) 
        return 1
    r =  x * NewJeChen(x-1)
    return r
}
var n = NewJeChen(5)
console.log("结果：" + n);

  function FiBo(num) {
      if (num < 0) {
        return '输入的数字不能小于0';
      } else if (num == 0) {
        return 0;
      } else if (num == 1) {
        return 1;
      } else if (num > 1) {
        return FiBo(num - 1) + FiBo(num - 2);
      }
  }

  function fn1()
  {
    var n = 1
    return   function fn2()
    {
        n=n+1
        console.log(n);
    }

  }
 var f =  fn1()
  f()
  f()
   